DO WHILE .not. Truepat .and. lastkey()<>27
   STORE 0 TO RECA,REC
   SET COLO TO BG+/B,W+/N
   @ 10,1 CLEA to 23,78
   DO BOXE WITH 10,2,'SURNAME :','PNAME','BG+','B','W+','N',16,.F.,.F.
   DO BOXE WITH 10,29,'FIRST NAME :','PFNAME','BG+','B','W+','N',16,.F.,.F.
   key1=Pname+PFname
   key2=Pfname+Pname
   DO BOXF WITH 15,25,"Processing, Please wait ...",'GR+','R','GR+*',.T.,.T.
   SET COLOR TO BG+/B
   SELE 1
   SET EXCLU OFF
   USE &DR&F1 INDE &DR&F11, &DR&F12
   sele 1
   SET INDEX TO &DR&F11
   seek key1
   if eof()
      SEEK KEY2
      IF EOF()
         SET INDEX TO &DR&F12
         seek key1
         if eof()
            SEEK KEY2
            IF EOF()
               OKK=.F.
               do PATR10
            ELSE
               STORE RECNO() TO REC,RECA
               KODEPAT=PAT_FILCOD
               OKK=.T.
            ENDIF
         else
            STORE RECNO() TO REC,RECA
            KODEPAT=PAT_FILCOD
            OKK=.T.
         endif
      ELSE
         STORE RECNO() TO REC,RECA
         KODEPAT=PAT_FILCOD
         OKK=.T.
      ENDIF
   else
      STORE RECNO() TO REC,RECA
      KODEPAT=PAT_FILCOD
      OKK=.T.
   endif
   if OKK=.T.
      STORE 0 TO cnt,CR
      GO RECA
      do while (Pname=pat_name .and. Pfname=pat_f_name) .or. (Pname=pat_f_name .and. PFname=pat_name)
         cnt=cnt+1
         skip
      enddo
      if cnt>1
         do patr777
      endif
      @ 12,1 CLEA TO 23,78
      DO PATR2B
      if pil4=2 .OR. PRPAT
         return
      endif
   ELSE
      PIL4=2
   ENDIF
ENDDO
return